import React, { useState } from "react"
/**
function Example(){
   const [Count, setCount] = useState(0);
    return(
     <div>
      <p>{Count}</p>
      <button onClick={()=>{setCount(Count+1)}}>add</button>
     </div>
   )
}
**/
function Example(){
	const [count,setCount] = useState(0);
	
       // setSide( side => side = !side)
       setSide((side)=>{
            return side = !side;
       })	
	const increment = () => setCount(count+1);
	return(
    <div>
      <h1>{count}</h1>
      <button onClick={increment}>add</button>
    </div>
	)
}

export default Example;